<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义对象方式2</title>
    <script type="text/javascript">
        var person = {
            name:"simple",
            age:20,
            hi:function (){
                console.log("person信息="+ this.name+" "+this.age);
            },
            sum:function (n1,n2){
                return n1+n2;
            }
        }
        //外部访问
        console.log("外部访问 name= " + person.name + " age= "+person.age)
        person.hi();
        console.log("sum=" + person.sum(10, 30));
    </script>
</head>
<body>

</body>
</html>